<?php
$questoes = $data[0];
?>

<div class="section">
    <a href="<?php echo BASE_URL; ?>questoes/form"><button type="button" class="blue"><span>Nova Questão</span></button></a>            
    <div class="box">
        <div class="title">
            Todas as questões
            <span class="hide"></span>
        </div>
        <div class="content">
            <table id="table-questoes" cellspacing="0" cellpadding="0" border="0" class="all"> 
                <thead> 
                    <tr>
                        <th>Código</th>
                        <th>Questão</th>
                        <th>Imagem</th>
                        <th>Resp.</th>
                        <th>Editar</th>
                        <th>Excluir</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    foreach ($questoes as $questao) {
                        echo "<tr>";
                        echo "<td>" . $questao->codigo . "</td>";
                        echo "<td>" . $questao->descricao;
                        echo "<br/><br/><b>Cargo: </b>" . $questao->Cargo->nome;
                        echo "  <b>Banca: </b>" . $questao->Banca->nome;
                        echo "  <b>Orgao: </b>" . $questao->Orgao->nome;
                        echo "  <b>Orgao: </b>" . $questao->ano;
                        echo "  <b>Resposta: </b>" . $questao->codigo_resposta . "</td>";
                        
                        echo "<td><a target='_blank' href='".BASE_URL."uploads/" . $questao->imagem . "'><img src='".BASE_URL."uploads/" . $questao->imagem . "' width='30px' height='30px' /></a></td>";
                        echo "<td><a href='#' class='item small list-respostas'>
                             <img src='" . BASE_URL . "gfx/icons/small/preferences.png' alt='Respostas'>
                             </a></td>";
                        echo "<td><a href='" . BASE_URL . "questoes/form?q=" . $questao->codigo . "' class='item small edit-questao'>
                             <img src='" . BASE_URL . "gfx/icons/small/edit.png' alt='Editar'>
                             </a></td>";
                        echo "<td><a href='#' class='item small excluir-questaos'>
                             <img src='" . BASE_URL . "gfx/icons/small/cancel.png' alt='Excluir'>
                             </a></td>";
                        echo "</tr>";
                    }
                    ?>
                </tbody>
            </table>
        </div>
    </div>
</div>